package junyi.power.actions;

import junyi.player.Health;
import junyi.player.Player;
import junyi.power.Action;
import junyi.power.effects.EffectSource;
import junyi.power.effects.PropertyChange;

/**
 * User: Junyi BEI
 * Date: 12-10-3
 * Time: 上午12:20
 */
public class DamageTargetPlayer extends Action {
  private Player target;
  private int expected;
  
  public DamageTargetPlayer(Player t, int e, EffectSource es) {
    super(es);
    target = t;
    expected = e;
  }

  @Override
  public int start(int c) {
    if(c != expected) {
      return Action.ACTION_FAILURE;
    }
    PropertyChange propertyChange = new PropertyChange<Integer>(target, Health.class, -1, effectSource);
    return propertyChange.start();
  }
}
